import mongoose from '../config/DBHelper'
import moment from 'moment'
const Schema = mongoose.Schema
const RoleSchema = new Schema({
  name: { type: String, default: '' },
  role: { type: String, default: '' },
  menu: { type: Array, default: [] },
  desc: { type: String, default: '' }
})

RoleSchema.pre('save', function (next) {
  this.created = moment().format('YYYY-MM-DD HH:mm:ss')
  next()
})

const Roles = mongoose.model('roles', RoleSchema)

export default Roles
